package serializable;

import java.io.Serializable;

public class User implements Serializable {
    private String name;
    private int age;
    public  static String from = "china";

    /**
     * transient关键字 阻止被序列化, 反序列化后被设置为初始值
     */
    private transient String gender;

    private static final long serialVersionUID = 1L;


    public User() {
    }

    public User(String name, int age, String gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", gender='" + gender + '\'' +
                ", from='" + from + '\'' +
                '}';
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
